<?php
header("Content-Type: text/html; charset=utf-8");
$private_key = '84cb28_SmartWeatherAPI_c23cc01';
$appid='bd487063600a7556';
$appid_six=substr($appid,0,6);
$areaid = '101280101';  
$type='forecast_v';
$date=date("YmdHi");
$public_key="http://open.weather.com.cn/data/?areaid=".$areaid."&type=".$type."&date=".$date."&appid=".$appid; 
$key = base64_encode(hash_hmac('sha1',$public_key,$private_key,TRUE)); 
$url="http://open.weather.com.cn/data/?areaid=".$areaid."&type=".$type."&date=".$date."&appid=".$appid_six."&key=".urlencode($key);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
echo $output;
$forecast_vInfo = json_decode($output, true);  //获取常规参数
var_dump($forecast_vInfo);
?>